#include "ProcessBar.h"
using func_t = void(*)(double,double);

void Download(func_t f)
{
    const int base = 20;
    double total = 2024.0;//总的下载量2024MB
    double cur = 0.0;
    ProcessBar(cur,total);
    while(cur < total)
    {
        double up_low = rand() % base;
        cur += up_low; 
        if(cur > total)
        {
            cur = total;
        }
        f(cur,total);
        usleep(100000);
    }
}
int main()
{
    srand(time(NULL));
    Download(ProcessBar);
    printf("\r\n");

    return 0;
}

